import { Navigate } from 'react-router-dom'
import { lazy } from "react";

const Register = lazy(() => import("../pages/Register"))
const Login = lazy(() => import("../pages/Login"))
const ForgetPwd = lazy(() => import("../pages/ForgetPwd"))
const Share = lazy(() => import("../pages/Share"));
const Home = lazy(() => import("../pages/Home"));
const Competition = lazy(() => import("../pages/Competition"));
const Team = lazy(() => import("../pages/Team"));
const Statistics = lazy(() => import("../pages/Statistics"));
const UserCenter = lazy(() => import('../pages/UserCenter'))
const BasicInfo = lazy(() => import('../pages/BasicInfo'))
const ReleaseGame = lazy(() => import('../pages/ReleaseGame'))
const SignUpGame = lazy(() => import('../pages/SignUpGame'))

// eslint-disable-next-line import/no-anonymous-default-export
export default [
    //登录页面
    {
        path: '/login',
        element: <Login />,
    },
    //注册页面
    {
        path: '/register',
        element: <Register />
    },
    //忘记密码
    {
        path: '/forgetpwd',
        element: <ForgetPwd />
    },
    //分享页面
    {
        path: '/share',
        element: <Share />
    },
    //首页
    {
        path: '/home',
        element: <Home />
    },
    //比赛
    {
        path: '/competition',
        element: <Competition />
    },
    //组队
    {
        path: '/team',
        element: <Team />
    },
    //统计
    {
        path: '/statistics',
        element: <Statistics />
    },
    //个人中心
    {
        path: '/user',
        element: <UserCenter />,
        children: [
            // 个人中心，基本信息
            {
                path: 'basicinfo',
                element: <BasicInfo />
            },
            //个人中心，发布比赛
            {
                path: 'releasegame',
                element: <ReleaseGame />
            },
            //个人中心，报名比赛
            {
                path: 'signupgame',
                element: <SignUpGame />
            },
            //重定向
            {
                path: "",
                element: <Navigate to={'basicinfo'} />
            }
        ]
    },
    //重定向
    {
        path: '/',
        element: <Navigate to={'/share'} />
    }
]